from scipy import stats
import evaluator as eval
import sys

def ttest(baseline, follow_up):
    paired_sample = stats.ttest_rel(baseline, follow_up)
    return paired_sample;


if __name__ == '__main__':
    baseline_file = sys.argv[1];
    follow_up_file = sys.argv[2];

    bdi = eval.main(baseline_file);
    fdi = eval.main(follow_up_file)

    dd = [];
    for i in range(len(bdi[5])):
        dd.append((fdi[5][i] - bdi[5][i],i));

    dd.sort();

    for i in range(10):
        print dd[i], i;
    for i in range(10):
        print dd[199-i], 199-i;
    for p in [1, 3, 5, 1]:
        val = ttest(bdi[p], fdi[p]);
        print "The t-statistic is %.3f and the p-value is %.3f." % val;
